﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.Collections.Generic;

namespace Tulde.MP3tunes
{
    public static class IEnumerableExtensions
    {
        public static ObservableCollection<T> ToObservableCollection<T>(this IEnumerable<T> source)
        {
            ObservableCollection<T> o = new ObservableCollection<T>();
            foreach (T item in source)
            {
                o.Add(item);
            }
            return o;
        }
        public static void CopyToObservableCollection<T>(this IEnumerable<T> source, ObservableCollection<T> target)
        {
            if (target != null)
                target.Clear();
            foreach (T item in source)
            {
                target.Add(item);
            }
        }

    }
}
